﻿/*
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * See product pages for more information.
 * http://closesudoku.codeplex.com
 * Copyright (C), 2010, hrondra
 */
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

using Fluid.Controls;
using Close.Properties;
using Close.Classes;

namespace Close.controls
{
    class SettingsDialog : FluidPanel
    {
        Color tabBackGroundActive = Color.SlateGray;

        int buttonWidth = 50;
        int panelWidth = ThemeClass.Settings.DisplayWidth;
        int leftMargin = 20;

        protected override void InitControl()
        {
            //TODO: add relevant settings
            base.InitControl();
            this.BackColor = tabBackGroundActive;
            Bounds = new Rectangle(0, 0, panelWidth, 100);

            int ContentWidth = panelWidth - 2 * leftMargin;

            FluidLabel lblTitle = new FluidLabel("Close Sudoku", leftMargin, 20, ContentWidth, 20);
            lblTitle.Font = new Font(FontFamily.GenericSansSerif, 8f, FontStyle.Regular);
            Controls.Add(lblTitle);

            String assemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            FluidLabel lblTimeTitle = new FluidLabel("Version: " + assemblyVersion, leftMargin, 32, ContentWidth, 20);
            lblTimeTitle.Font = new Font(FontFamily.GenericSansSerif, 7f, FontStyle.Regular);
            Controls.Add(lblTimeTitle);

            FluidLabel lblAuthor = new FluidLabel("©2011, hrondra", leftMargin, 44, ContentWidth, 20);
            lblAuthor.Font = new Font(FontFamily.GenericSansSerif, 7f, FontStyle.Regular);
            Controls.Add(lblAuthor);

            FluidLabel lblLink = new FluidLabel("http://closesudoku.codeplex.com/", leftMargin, 56, ContentWidth, 20);
            lblLink.Font = new Font(FontFamily.GenericSansSerif, 7f, FontStyle.Regular);
            Controls.Add(lblLink);

            FluidButton btnExit = new FluidButton(Resources.PopupClose);
            btnExit.Bounds = new Rectangle((Bounds.Width - buttonWidth) / 2, 75, buttonWidth, 20);
            //btnExit.Command = commandExit;
            btnExit.Click += new EventHandler(okBtn_Click);
            btnExit.BackColor = ThemeClass.Settings.NumpadBackroundColor;
            btnExit.ForeColor = ThemeClass.Settings.NumpadForeColor;
            Controls.Add(btnExit);

            FluidLabel lblLink3 = new FluidLabel(String.Format("Display size {0} x {1} px.", ThemeClass.Settings.DisplayWidth, ThemeClass.Settings.DisplayHeight), leftMargin, 0, ContentWidth, 20);
            lblLink3.Font = new Font(FontFamily.GenericSansSerif, 7f, FontStyle.Regular);
            Controls.Add(lblLink3);
        }

        public static new void Show()
        {
            SettingsDialog dialog = new SettingsDialog();
            dialog.ShowModal(ShowTransition.FromBottom);
        }

        void okBtn_Click(object sender, EventArgs e)
        {
            Close(ShowTransition.FromBottom);
        }
    }
}
